function checkGoal(pole)
{
	 var W = /^[0-9]{1,}$/;
     if (pole.value.match(W))
        {
           return true;
        }
     else
        {

           return false;
        }
}

function checkName(pole)
{
   if (!pole.value == " ")
      {
         return true;
      }
   else
      {

         return false;
      }
}

function checkFirstName(pole)
{
   if (!pole.value == " ")
      {
         return true;
      }
   else
      {

         return false;
      }
}

function checkLastName(pole)
{
   if (!pole.value == " ")
      {
         return true;
      }
   else
      {

         return false;
      }
}

window.onload = function()
{
   document.getElementById("form").onsubmit = function()
      {
         var tekst='';
         
         var goal =  document.getElementById("goal");
         var firstname =  document.getElementById("firstname");
         var lastname =  document.getElementById("lastname");
         var pass = document.getElementById("pass");
         
         if(!checkGoal(goal)){
             tekst += "Niepoprawny cel \n";
         }
         if(!checkName(pass)){
             tekst += "Nazwa planu nie moze byc pusta \n";
         }
         if(!checkFirstName(firstname)){
             tekst += "Podaj imie \n";
         }
         if(!checkLastName(lastname)){
             tekst += "Podaj nazwisko \n";
         }
         

         if (tekst!="") {
             alert ("WYSTAPILY NASTEPUJACE BLEDY\n"+tekst);
                    return false;
         } else {
            return true;
         }

      };

};